package com.dts;

import com.dts.entity.Emp;
import com.dts.entity.Student;
import com.dts.service.EmpService;
import com.github.pagehelper.PageInfo;
import org.apache.log4j.Logger;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Test {
    private static final Logger logger = Logger.getLogger(Test.class);
    public static void main(String[] args)  {
        //加载spring配置
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
//        context= new AnnotationConfigApplicationContext()
        Student student = (Student)context.getBean("student");
        student.displayInfo();
        EmpService empService = (EmpService) context.getBean("empService");
//        empService.addEmp();
        PageInfo<Emp> pageInfo = empService.pageQuery(1, 5);
        pageInfo.getList().forEach(emp -> System.out.println(emp.getEmpName()));
    }
}